package cate.common.table.common;

import cate.common.table.ESheet;
import cate.common.util.XT;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class NameGuildSheet extends ESheet<NameGuildRow> {

    @Override
    public String getSheetName() {
        return "公会名称";
    }

    public String random() {
        int i = XT.randomIndex(list.size());
        return list.get(i).value;
    }

    public List<String> getName(int num) {
        Collections.shuffle(list);
        List<String> result = new ArrayList<>();
        for (NameGuildRow row : this.getList()) {
            if (result.size() < num) {
                result.add(row.value);
            } else {
                return result;
            }
        }
        return result;
    }
}